package cn.sdut.training.web.action;

import java.util.List;

import javax.annotation.Resource;

import com.opensymphony.xwork2.ActionSupport;

import cn.sdut.training.domain.Academy;
import cn.sdut.training.domain.Majore;
import cn.sdut.training.service.TrainingService;

public class MajoreAction extends ActionSupport {

	private static final long serialVersionUID = 3691251281212576499L;
	private Majore majore;
	private Long id;
	private Long aid;	//academyId
	private List<Majore> majoreList;
	private List<Academy> AcademyList;
	
	
	@Resource
	private TrainingService trainingService;
	
	/**
	 * 执行保存的方法，需要设置专业的学院信息
	 * @return
	 */
	public String save(){
		Academy academy = trainingService.getAcademyById(aid);
		majore.setAcademy(academy);
		trainingService.saveMajore(majore);
		return "toList";
	}
	
	/**
	 * 转到列表页面
	 * @return
	 */
	public String toListPage(){
		return "toListPage";
	}
	
	/**
	 * 执行删除操作
	 * @return
	 */
	public String delete(){
		trainingService.deleteMajore(id);
		return "toList";
	}
	
	//-------------------------------------------------
	
	public Long getId() {
		return id;
	}

	public Majore getMajore() {
		return majore;
	}

	public void setMajore(Majore majore) {
		this.majore = majore;
	}

	public List<Majore> getMajoreList() {
		return majoreList;
	}

	public void setMajoreList(List<Majore> majoreList) {
		this.majoreList = majoreList;
	}

	public void setId(Long id) {
		this.id = id;
	}
	public List<Academy> getAcademyList() {
		return AcademyList;
	}

	public void setAcademyList(List<Academy> academyList) {
		AcademyList = academyList;
	}

	public Long getAid() {
		return aid;
	}

	public void setAid(Long aid) {
		this.aid = aid;
	}
	
	
}
